<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>const 常量的使用和注意</title>
</head>
<body>
  <script>
    //常量 一旦定义就不能修改的量
    const pi = 3.1415;
    console.log(pi);// 3.1415
    pi = 3.1415926;//报错
  </script>

  <script>
    
    //常量必须首先声明
    const a;//报错

  </script>
  
  <script>
    //常量有块级作用域
    {
      const a = 10;
      console.log(a);// 10
    }
    console.log(a);// 报错
  </script>
</body>
</html>